<%@ page import="org.subject.entity.User" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
    .bg {
        color: #2777ad;
        left: 0px;
    }

    .right a {
        color: #FFFFFF;
    }

    .img {
        width: 100%;
        height: 100px;
    }

    .navbg {
        color: #1b5799;
        background: #9C9C9C;
    }

    .nav ul {
        width: auto; /*设置元素宽度为980px*/
        border: 0px solid #000; /*设置一个颜色为#000，宽度为1px的边框*/
        margin: 0px auto; /*也可以简写为margin:0 auto*/
        list-style: none;
    }

    .nav ul li {
        float: left; /*让li元素左浮动*/
        list-style: none;
        font-size: 18px;
    }

    .nav ul li a {
        width: 80px; /*设置元素宽为80px*/
        height: 28px; /*设置高度为28px*/
        line-height: 28px; /*设置行距为28px，让文字在每行的中间位置*/
        color: #FFF; /*文字颜色是白色*/
        margin: 5px 10px;
        font-size: 12px; /*用12号字*/
        display: block; /*这个比较关键，因为a本身就是联级元素，本身不具有宽高，用这个把它变成块级元素，这样前面设置的宽和高就能起作用了*/
        text-align: center; /*让文本居中*/
        text-decoration: none; /*去掉下划线*/
    }
</style>
<%
    User user = (User) session.getAttribute("user");
%>
<header class="bg">
    <div style="height: 80px;width: 100%;" background="/./resource/images/bg.jpg">
        <img src="/./resource/images/logo1.png" style="margin-top: 10px">
        <span style="color: white;font-size: large;">学科竞赛管理系统</span>
        <c:choose>
            <c:when test="${sessionScope.user != null}">
                    <span style="float: right;margin-top: 10px;margin-right: 20px;"><a
                            style="text-decoration:none;color:white;"
                            href="/user/detail?userId=<%=user.getUserId()%>"><%=user.getUserName()%>
                    </a><span style="color: white;"> | </span><a style="text-decoration:none;color:white;"
                                                                 href="/login/remove">退出</a></p>
                </span>
            </c:when>
        </c:choose>
    </div>
    <%--<img class="img" src="/./resource/images/logo.jpg">--%>
    <div class="nav navbg">
        <ul>
            <li><a href="/" class="link">首页</a></li>
            <c:choose>
                <c:when test="${user.getUserRole() == 2 || user.getUserRole()==1}">
                    <li><a href="/message/publishpage" role="tab">发布竞赛</a></li>
                </c:when>
            </c:choose>
            <c:choose>
                <c:when test="${user.getUserRole()==1}">
                    <li><a href="/message/list">竞赛管理</a></li>
                </c:when>
            </c:choose>
            <c:choose>
                <c:when test="${sessionScope.user != null}">
                </c:when>
                <c:otherwise>
                    <li><a href="/user/register">注册</a></li>
                </c:otherwise>
            </c:choose>
            <c:choose>
                <c:when test="${sessionScope.user != null}">
                    <li><a href="/user/detail?userId=<%=user.getUserId()%>">个人中心</a></li>
                </c:when>
            </c:choose>
            <li><a href='<%=request.getContextPath()%>/article/findById?id=1003' class="link">关于我们</a></li>
        </ul>
        <%--<div class="nav-search">

            <div class="search">
                <form name="searchForm" onsubmit='return checkform()' ; action="search/" method="get" target="_blank">
                    <input class="h-text" type="text" name="q" value="请输入关键字" onFocus="if (value =='请输入关键字'){value =''}"
                           onBlur="if (value ==''){value='请输入关键字'}"/>
                    <input class="h-button" type="submit" value=""/>
                </form>
            </div>
        </div>--%>
    </div>
    <img class="img" src="/./resource/images/mid_img.png" hidden>
</header>
